package edu.sctu.practice.class01.wangxiaoqiang.assgin2;

/**
 * Created by admin on 2015/10/8.
 */
public class Rational {

    float a;
    float b;
    float result;

    public Rational(int a, int b) {
        this.a = a;
        this.b = b;
    }

    public float add() {


        result = a + b;
        return result;

    }

    public float sub() {
        result = a - b;
        return result;

    }

    public float mul() {
        result = a * b;
        return result;

    }

    public float div() {
        if (b == 0) {
            b = 1;
        }
        result = a / b;
        return result;
    }
}
